package com.xiguaji.tiktok.task.ranking;


import com.xiguaji.boot.eventbus.EventBusTemplate;
import com.xiguaji.tiktok.task.core.ScheduleTemplate;
import com.xiguaji.tiktok.task.ranking.event.FetchBloggerRankingEventListener;
import com.xiguaji.tiktok.task.ranking.event.FetchBloggerRankingFollowerEventListener;
import com.xiguaji.tiktok.task.ranking.event.FetchEnterpriseRankingEventListener;
import com.xiguaji.tiktok.task.ranking.event.FetchRegionRankingEventListener;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.val;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class RankingTask {

    @Autowired
    EventBusTemplate eventBusTemplate;

    @Autowired
    ScheduleTemplate scheduleTemplate;

    @XxlJob("fetchBloggerRankingEvent")
    public ReturnT<String> fetchBloggerRankingEvent(String param){
        val fetchBloggerRankingEvent = new FetchBloggerRankingEventListener.FetchBloggerRankingEvent();
        eventBusTemplate.post(fetchBloggerRankingEvent);
        return ReturnT.SUCCESS;
    }

    @XxlJob("fetchBloggerRankingFollowerEvent")
    public ReturnT<String> fetchBloggerRankingFollowerEvent(String param){
        val fetchBloggerRankingFollowerEvent = new FetchBloggerRankingFollowerEventListener.FetchBloggerRankingFollowerEvent();
        eventBusTemplate.post(fetchBloggerRankingFollowerEvent);
        return ReturnT.SUCCESS;
    }

    @XxlJob("fetchBloggerEnterpriseRankingEvent")
    public ReturnT<String> fetchBloggerEnterpriseRankingEvent(String param){
        val fetchBloggerRankingEvent = new FetchEnterpriseRankingEventListener.FetchBloggerRankingEvent();
        eventBusTemplate.post(fetchBloggerRankingEvent);
        return ReturnT.SUCCESS;
    }

    @XxlJob("fetchBloggerRegionRankingEvent")
    public ReturnT<String> fetchBloggerRegionRankingEvent(String param){
        val fetchBloggerRankingFollowerEvent = new FetchRegionRankingEventListener.FetchBloggerRankingEvent();
        eventBusTemplate.post(fetchBloggerRankingFollowerEvent);
        return ReturnT.SUCCESS;
    }
}
